﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LotteryVote.Entity;
using System.Data.SqlClient;

namespace LotteryVote.Data
{
    public class SystemErrorDataAccess : DataBase
    {
        public void Insert(SystemError error)
        {
            string sql = string.Format(@"INSERT INTO {0} ({1},{2},{3},{4}) VALUES (@{1},@{2},@{3},@{4})", SystemError.TABLENAME, SystemError.ERRORMESSAGE,
                SystemError.ERRORLEVEL, SystemError.STACKTRACK, SystemError.PAGEURL);
            base.ExecuteNonQuery(sql, new SqlParameter(SystemError.ERRORMESSAGE, error.ErrorMessage),
                new SqlParameter(SystemError.ERRORLEVEL, (int)error.ErrorLevel),
                new SqlParameter(SystemError.STACKTRACK, error.StackTrack),
                new SqlParameter(SystemError.PAGEURL, error.PageUrl));
        }
    }
}
